<script setup lang="ts">
import myCard from '@/pages/my/components/myCard.vue'
import { ref } from 'vue'
import { getMyActivities } from '@/services/my/MyActivities/activities'
import NoData from '@/components/NoData/NoData.vue'
import { onLoad } from '@dcloudio/uni-app'

// 获取到用户的ID
const userID = uni.getStorageSync('userInfo').id

// 活动数据列表
const list = ref([])
// 获取用户所参加的活动
const getMyActivitiesList = async () => {
  const res: any = await getMyActivities(userID)
  list.value = res?.data?.result
}
onLoad(() => {
  getMyActivitiesList()
})
// 没有数据中的文本信息
const text = '暂无活动'
</script>
<template>
  <view v-if="list.length > 0">
    <scroll-view scroll-y class="myActivities">
      <myCard :signList="list"></myCard>
    </scroll-view>
  </view>
  <NoData :msg="text" v-else />
</template>

<style scoped lang="scss">
.myActivities {
  width: 100%;
  height: 100%;
  padding: 3%;
  box-sizing: border-box;
  background-color: #f6f6f6;
}
</style>
